package com.s2paganini.display
{
	import com.s2paganini.util.Utils;		import flash.display.Shape;	import flash.display.Sprite;	

	/**
	 * @author @ndre elvan
	 */
	 	public class ArrowButton extends Sprite {
		
		private var _direction:String;
		private var _size:Number;
		private var _arrow:Shape;
		private var _btn:Sprite;
		
		
		public function ArrowButton(__direction:String, __size:Number = 9) {
			_direction = __direction;
			_size = __size;
			init();
		}
		
		private function init():void {
			_arrow = new Shape();
			_arrow.graphics.beginFill(0x626263, 1);
			if (_direction=="left") {
				_arrow.graphics.moveTo(_size/2, -_size);
				_arrow.graphics.lineTo(_size/2, _size);
				_arrow.graphics.lineTo(-_size/2, 0);
				_arrow.graphics.lineTo(_size/2, -_size);
			} else {
				_arrow.graphics.moveTo(-_size/2, -_size);
				_arrow.graphics.lineTo(-_size/2, _size);
				_arrow.graphics.lineTo(_size/2, 0);
				_arrow.graphics.lineTo(-_size/2, -_size);
			}
			_arrow.graphics.endFill();
			addChild(_arrow);
			
			_btn = new Sprite();
			Utils.drawSquareGraphic(_btn.graphics, _size*2, _size*2, 0xff0000, 0, -_size, -_size);
			addChild(_btn);
		}
		
	}
}